package com.yiqi.lottery.feature.mine.model;

import com.suozhang.framework.component.http.RxDataProcessFactory;
import com.yiqi.lottery.entity.bo.BaseBo;
import com.yiqi.lottery.entity.bo.RegisterBo;
import com.yiqi.lottery.entity.bo.StationBo;
import com.yiqi.lottery.entity.bo.WithdrawBo;
import com.yiqi.lottery.feature.mine.contract.BindContract;
import com.yiqi.lottery.feature.mine.contract.StationContract;
import com.yiqi.lottery.feature.mine.dependencies.bind.DaggerBindModelComponent;
import com.yiqi.lottery.feature.mine.dependencies.station.DaggerStationModelComponent;
import com.yiqi.lottery.framework.api.ApiLib;
import com.yiqi.lottery.framework.api.UserApi;
import io.reactivex.Observable;

import javax.inject.Inject;

public class StationModel implements StationContract.Model {

    @Inject
    UserApi api;


    @Inject
    public StationModel() {

       DaggerStationModelComponent.builder().apiComponent(ApiLib.apiComponent()).build().inject(this);
    }


    @Override
    public Observable<StationBo> getStationInfo() {
        return api.getShopInfo().compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<String> editWithDraw(WithdrawBo withdrawBo) {
        return api.editWithDraw(withdrawBo).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<WithdrawBo> editWithDraw() {
        return api.getWithDraw().compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }
}
